package com.intelligent.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * 发货管理表
 * @TableName delivery_management
 */
@TableName(value ="delivery_management")
@Data
public class DeliveryManagement implements Serializable {
    /**
     * 记录ID（自增主键）
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 发货单号
     */
    private String deliveryOrderNo;

    /**
     * 审批状态(0 审核通过 1 待审核 2 审核驳回)
     */
    private Integer approvalStatus;

    /**
     * 申请时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")

    private Date applyTime;

    /**
     * 申请人
     */
    private Long uId;

    /**
     * 客户
     */
    private Long customerId;

    /**
     * 关联销售单
     */
    private Long salesId;

    /**
     * 期望发货时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")

    private Date expectedDeliveryDate;

    /**
     * 出库状态(0 全部出库 1 部分出库 2 未出库)
     */
    private Integer outboundStatus;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        DeliveryManagement other = (DeliveryManagement) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getDeliveryOrderNo() == null ? other.getDeliveryOrderNo() == null : this.getDeliveryOrderNo().equals(other.getDeliveryOrderNo()))
            && (this.getApprovalStatus() == null ? other.getApprovalStatus() == null : this.getApprovalStatus().equals(other.getApprovalStatus()))
            && (this.getApplyTime() == null ? other.getApplyTime() == null : this.getApplyTime().equals(other.getApplyTime()))
            && (this.getUId() == null ? other.getUId() == null : this.getUId().equals(other.getUId()))
            && (this.getCustomerId() == null ? other.getCustomerId() == null : this.getCustomerId().equals(other.getCustomerId()))
            && (this.getSalesId() == null ? other.getSalesId() == null : this.getSalesId().equals(other.getSalesId()))
            && (this.getExpectedDeliveryDate() == null ? other.getExpectedDeliveryDate() == null : this.getExpectedDeliveryDate().equals(other.getExpectedDeliveryDate()))
            && (this.getOutboundStatus() == null ? other.getOutboundStatus() == null : this.getOutboundStatus().equals(other.getOutboundStatus()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getDeliveryOrderNo() == null) ? 0 : getDeliveryOrderNo().hashCode());
        result = prime * result + ((getApprovalStatus() == null) ? 0 : getApprovalStatus().hashCode());
        result = prime * result + ((getApplyTime() == null) ? 0 : getApplyTime().hashCode());
        result = prime * result + ((getUId() == null) ? 0 : getUId().hashCode());
        result = prime * result + ((getCustomerId() == null) ? 0 : getCustomerId().hashCode());
        result = prime * result + ((getSalesId() == null) ? 0 : getSalesId().hashCode());
        result = prime * result + ((getExpectedDeliveryDate() == null) ? 0 : getExpectedDeliveryDate().hashCode());
        result = prime * result + ((getOutboundStatus() == null) ? 0 : getOutboundStatus().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", deliveryOrderNo=").append(deliveryOrderNo);
        sb.append(", approvalStatus=").append(approvalStatus);
        sb.append(", applyTime=").append(applyTime);
        sb.append(", uId=").append(uId);
        sb.append(", customerId=").append(customerId);
        sb.append(", salesId=").append(salesId);
        sb.append(", expectedDeliveryDate=").append(expectedDeliveryDate);
        sb.append(", outboundStatus=").append(outboundStatus);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}
